const obj = {
  name: "yz",
  age: 18
}

Object.keys(obj).forEach(key => {
  let value = obj[key]

  Object.defineProperty(obj, key, {
    get: function() {
      console.log("get");
      return value
    },
    set: function(newValue) {
      console.log("set");
      value = newValue
    }
  })
})

obj.name = "jay"
obj.age = 19
console.log(obj.name);
console.log(obj.age)

